#include "bullet.h"

bullet::bullet()
{
    bullet_pixmap.load(PLANE_BULLET);

    bullet_x=0;
    bullet_y=0;

    bullet_free=true;

    bullet_speed=PLANE_BULLET_SPEED;

    bullet_rect.setWidth(BULLET_WIDTH);
    bullet_rect.setHeight(BULLET_HEIGHT);
    bullet_rect.moveTo(bullet_x,bullet_y);
}

void bullet::bulletPosition()
{
    if(bullet_free){
        return;
    }

    bullet_y-=bullet_speed;
    bullet_rect.moveTo(bullet_x,bullet_y);

    if(bullet_y<=-bullet_pixmap.height()){
        bullet_free=true;
    }
}
